var t = require;
var e = module;
var o = exports;
var i, n = this && this.__extends || (i = function(t, e) {
    return (i = Object.setPrototypeOf || {
        __proto__: []
    }
    instanceof Array &&
    function(t, e) {
        t.__proto__ = e
    } ||
    function(t, e) {
        for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o])
    })(t, e)
},
function(t, e) {
    function o() {
        this.constructor = t
    }
    i(t, e),
    t.prototype = null === e ? Object.create(e) : (o.prototype = e.prototype, new o)
}),
a = this && this.__decorate ||
function(t, e, o, i) {
    var n, a = arguments.length,
    r = a < 3 ? e: null === i ? i = Object.getOwnPropertyDescriptor(e, o) : i;
    if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(t, e, o, i);
    else for (var s = t.length - 1; s >= 0; s--)(n = t[s]) && (r = (a < 3 ? n(r) : a > 3 ? n(e, o, r) : n(e, o)) || r);
    return a > 3 && r && Object.defineProperty(e, o, r),
    r
};
Object.defineProperty(o, "__esModule", {
    value: !0
}),
o.Box_Type = void 0;
var r = t("GlobalUserData"),
s = t("Util"),
l = t("HallConstant"),
c = t("CarConstant"),
d = t("BoxGetItem"),
h = t("BroadCastMessage"),
p = t("GoldFlyAnim"),
u = t("StorageManager"),
f = t("Global"),
m = t("BaseStorage"),
_ = t("Common"),
y = t("WXSDK");
o.Box_Type = {
    Default: 0,
    common: 1,
    middle: 2,
    senior: 3
};
var g = cc._decorator,
v = g.ccclass,
C = g.property,
b = function(t) {
    function e() {
        var e = null !== t && t.apply(this, arguments) || this;
        return e.pfb_getItems = null,
        e.pfb_goldfly = null,
        e.node_bg_unOpen = null,
        e.node_bg_open = null,
        e.node_topFrame = null,
        e.frame_notOpen = null,
        e.frame_open = null,
        e.frame_get = null,
        e.frame_lock = null,
        e.frame_unlock = null,
        e.frame_openBtn = null,
        e.frame_openItems = null,
        e.lab_unlockTime = null,
        e.lab_itemsNum = null,
        e.node_light = null,
        e.node_boxIcon = null,
        e.node_openTitle = null,
        e.node_getItem = null,
        e.node_rollFrame = null,
        e.spine_open = null,
        e.node_btnSkip = null,
        e.icon_gold = null,
        e.lab_gold = null,
        e.icon_diamond = null,
        e.lab_diamond = null,
        e.spine_open_common = null,
        e.spine_open_middle = null,
        e.spine_open_senior = null,
        e.arrNode_star = new Array(5),
        e.nodeHp = null,
        e.nodeElec = null,
        e.nodeDamage = null,
        e.btnVideo = null,
        e.btnBack = null,
        e._hallBoxItem = null,
        e._hallControl = null,
        e.nGetItemsNum = 0,
        e.arrGetItems = new Array,
        e.arrGetItemsData = [],
        e._curBoxType = o.Box_Type.Default,
        e.prevOwnGold = 0,
        e.prevDiamondNum = 0,
        e.bGetOpenBox = !1,
        e.curShowItemIndex = 0,
        e.arrRollItem = [],
        e.nMaxRollItem = 7,
        e.nRollItemWidth = 250,
        e.nRollCentIndex = Math.floor(e.nMaxRollItem / 2),
        e.bRollAnim = !1,
        e
    }
    return n(e, t),
    e.prototype.onLoad = function() {
        this.resetView(),
        this.onSetOwnGold(),
        this.onSetOwnDiamond()
    },
    e.prototype.start = function() {
        s.Util.hideHallBanner(),
        u.StorageManager.setDailyTaskStorageKey(f.BaseStorageKey.GetBoxNumber),
        s.Util.hideSingleCustomAd(!0),
        s.Util.hideSingleCustomAd(!1),
        s.Util.hideNativeGridAd(),
        s.Util.is_VIVO() || s.Util.is_tt() || s.Util.showBanner(),
        this.btnVideo.active = !1,
        this.btnBack.active = !1
    },
    e.prototype.update = function() {
        this.bRollAnim && this.onRollAnim()
    },
    e.prototype.onSetOwnGold = function(t) {
        var e = this;
        t ? (this.icon_gold.stopAllActions(), s.Util.AnimNumJump(this.lab_gold.node, this.prevOwnGold, r.default.nGlod,
        function(t) {
            e.lab_gold.getComponent(cc.Label).string = s.Util.transformGoldStr(t)
        },
        function() {
            e.lab_gold.getComponent(cc.Label).string = s.Util.transformGoldStr(r.default.nGlod),
            e.prevOwnGold = r.default.nGlod
        },
        this.icon_gold)) : (this.lab_gold.string = s.Util.transformGoldStr(r.default.nGlod), this.prevOwnGold = r.default.nGlod)
    },
    e.prototype.onSetOwnDiamond = function(t) {
        var e = this;
        t ? s.Util.AnimNumJump(this.lab_diamond.node, this.prevDiamondNum, r.default.nDiamond,
        function(t) {
            e.lab_diamond.getComponent(cc.Label).string = s.Util.transformGoldStr(t)
        },
        function() {
            e.lab_diamond.getComponent(cc.Label).string = s.Util.transformGoldStr(r.default.nDiamond),
            e.prevDiamondNum = r.default.nDiamond
        },
        this.icon_diamond) : (this.lab_diamond.string = s.Util.transformGoldStr(r.default.nDiamond), this.prevDiamondNum = r.default.nDiamond)
    },
    e.prototype.resetView = function() {
        this.node_bg_open.active = !1,
        this.node_topFrame.active = !1,
        this.node_bg_unOpen.active = !0,
        this.node.active = !0,
        this.frame_notOpen.active = !1,
        this.frame_open.active = !1,
        this.frame_get.active = !1,
        this.spine_open_common.node.active = !1,
        this.spine_open_middle.node.active = !1,
        this.spine_open_senior.node.active = !1,
        this.frame_lock.active = !1,
        this.frame_unlock.active = !1,
        this.node_boxIcon.active = !0,
        this.spine_open.node.active = !1,
        this.node_rollFrame.parent.active = !1,
        this.node_btnSkip.active = !1,
        this.node_getItem.active = !1;
        for (var t = 0; t < this.arrGetItems.length; t++) this.arrGetItems[t] && this.arrGetItems[t].setActive(!1)
    },
    e.prototype.showView = function(t, e, o) {
        this.resetView(),
        this._curBoxType = t,
        this._hallBoxItem = e,
        this._hallControl = o,
        this.nGetItemsNum = 4,
        this.bGetOpenBox = !1,
        this.showOpenView()
    },
    e.prototype.showOpenBoxView = function(t, e) {
        s.Util.hideHallBanner(),
        this.resetView(),
        console.log("boxType: " + t),
        this._curBoxType = t,
        this._hallControl = e,
        this.bGetOpenBox = !1,
        this.showOpenView(),
        this.onBtnOpenBox()
    },
    e.prototype.showUnlockView = function() {
        this.frame_lock.active = !1,
        this.frame_unlock.active = !0,
        this.frame_notOpen.active = !0,
        this.lab_itemsNum.string = this.nGetItemsNum.toString()
    },
    e.prototype.onBtnLockOpen = function() {
        this.playAudio(l.Audio_ID.btn_click),
        this.showOpenView()
    },
    e.prototype.showOpenView = function() {
        this.frame_notOpen.active = !1,
        this.frame_open.active = !0,
        this.frame_openBtn.active = !0,
        this.frame_openItems.active = !1,
        (s.Util.is_wx() || s.Util.is_tt()) && s.Util.showBanner(),
        cc.tween(this.node_light).by(4, {
            angle: 360
        }).repeatForever().start()
    },
    e.prototype.showAllGetView = function() {
        var t = this;
        this.frame_notOpen.active = !1,
        this.frame_open.active = !1,
        this.frame_get.active = !0,
        s.Util.is_tt() && !r.default.bAuditMode && (this.frame_get.active = !1, this.btnVideo.active = !0, setTimeout(function() {
            t.btnBack.active = !0
        },
        2e3)),
        s.Util.hideNativeBanner(),
        s.Util.is_VIVO() && !r.default.bAuditMode ? s.Util.showNativeMatchBanner() : s.Util.isBannerSwitchOn() ? (s.Util.hideBanner(), this.frame_get.y = -36, setTimeout(function() {
            y.default.getIntance().show_majia_banner(function() {
                t.frame_get.y = 90
            })
        },
        1e3 * r.default.majiaDelay)) : this.frame_get.y = 90;
        for (var e = 0; e < this.nGetItemsNum; e++) this.arrGetItems[e].node.active = !0,
        this.arrGetItems[e].setPos(this.nGetItemsNum, e)
    },
    e.prototype.onBtnOpenBox = function() {
        var t = this;
        switch (s.Util.hideBoxNativeInsertAd(), s.Util.showNativeBanner(2, null), console.log("打开状态下  打开 宝箱"), s.Util.is_wx() && s.Util.showBanner(), r.default.saveOpenBoxNum(!0), this._curBoxType) {
            case o.Box_Type.common:
                cc.log("打开普通宝箱"),
            r.default.addOpenCommonBoxNum();
            break;
            case o.Box_Type.middle:
                cc.log("打开史诗宝箱"),
            r.default.addOpenEpicBoxNum();
            break;
            case o.Box_Type.senior:
                cc.log("打开传说宝箱"),
            r.default.addOpenLegendBoxNum();
        }
        cc.log("打开宝箱次数" + r.default.openBoxNum);
        var e = m.BaseStorage.getInt(f.BaseStorageKey.GetBoxNumber, 0) + 1;
        m.BaseStorage.setInt(f.BaseStorageKey.GetBoxNumber, e),
        this.playAudio(l.Audio_ID.btn_click);
        try {
            this.scheduleOnce(function() {
                t.playAudio(l.Audio_ID.gacha_opening)
            },
            1)
        } catch(n) {
            console.error(n)
        }
        this.node_light.stopAllActions(),
        this.node_bg_open.active = !0,
        this.node_topFrame.active = !0,
        this.node_openTitle.active = !1,
        this.frame_openBtn.active = !1,
        this.node_getItem.active = !1,
        this.curShowItemIndex = 0,
        this.arrGetItemsData = this.getAllItemsData();
        for (var i = 0; i < this.arrGetItems.length; i++) this.arrGetItems[i].node.active = !1;
        this.arrGetItems[this.curShowItemIndex] ? (this.arrGetItems[this.curShowItemIndex].updateView(this.arrGetItemsData[this.curShowItemIndex]), this.arrGetItems[this.curShowItemIndex].setPos(0), this.arrGetItems[this.curShowItemIndex].node.active = !0) : (this.arrGetItems[this.curShowItemIndex] = this.createItem(this.arrGetItemsData[this.curShowItemIndex]), this.arrGetItems[this.curShowItemIndex].node.active = !0),
        this.bGetOpenBox ? this.playAnimOpen() : this.playAnimOpenFirst()
    },
    e.prototype.onBtnOpenItems = function() {
        this.playAudio(l.Audio_ID.btn_click);
        try {
            this.playAudio(l.Audio_ID.gacha_opening_part)
        } catch(e) {}
        if (this.curShowItemIndex++, this.curShowItemIndex >= this.nGetItemsNum) this.showAllGetView();
        else {
            this.node_getItem.active = !1;
            for (var t = 0; t < this.arrGetItems.length; t++) this.arrGetItems[t].node.active = !1;
            this.arrGetItems[this.curShowItemIndex] ? (this.arrGetItems[this.curShowItemIndex].updateView(this.arrGetItemsData[this.curShowItemIndex]), this.arrGetItems[this.curShowItemIndex].setPos(0), this.arrGetItems[this.curShowItemIndex].node.active = !0) : (this.arrGetItems[this.curShowItemIndex] = this.createItem(this.arrGetItemsData[this.curShowItemIndex]), this.arrGetItems[this.curShowItemIndex].node.active = !0),
            this.frame_openItems.active = !0,
            this.node_getItem.active = !0,
            s.Util.is_wx() && s.Util.showBanner(),
            cc.tween(this.arrGetItems[this.curShowItemIndex].node).to(.2, {
                scale: 1.8
            }).to(.3, {
                scale: 1
            }).to(.2, {
                scale: 1.3
            }).to(.2, {
                scale: 1
            }).start()
        }
    },
    e.prototype.plyOpenBoxAnim = function() {
        this.node_rollFrame.parent.active = !1,
        this.frame_openItems.active = !0,
        this.node_getItem.active = !0,
        cc.tween(this.arrGetItems[this.curShowItemIndex].node).to(.2, {
            scale: 1.8
        }).to(.3, {
            scale: 1
        }).to(.2, {
            scale: 1.3
        }).to(.2, {
            scale: 1
        }).start()
    },
    e.prototype.playAnimOpen = function() {
        var t = this,
        e = null,
        i = 0;
        switch (this._curBoxType) {
            case o.Box_Type.common:
                e = this.spine_open_common,
            i = 3.2;
            break;
            case o.Box_Type.middle:
                e = this.spine_open_middle,
            i = 4.6;
            break;
            case o.Box_Type.senior:
                e = this.spine_open_senior,
            i = 5;
        }
        e.node.active = !0,
        e.setAnimation(0, "animation", !1),
        this.scheduleOnce(function() {
            t.node_rollFrame.parent.active = !1,
            t.frame_openItems.active = !0,
            t.node_getItem.active = !0,
            t.onBtnSkip(),
            e.node.active = !1
        },
        i)
    },
    e.prototype.playAnimOpenFirst = function() {
        var t = this,
        e = 0;
        switch (this._curBoxType) {
            case o.Box_Type.common:
                this.spine_open = this.spine_open_common,
            e = 3.2;
            break;
            case o.Box_Type.middle:
                this.spine_open = this.spine_open_middle,
            e = 4.6;
            break;
            case o.Box_Type.senior:
                this.spine_open = this.spine_open_senior,
            e = 5;
        }
        this.spine_open.node.active = !0,
        this.onCreateRollFrame(),
        this.spine_open.setAnimation(0, "animation", !1),
        this.scheduleOnce(function() {
            t.plyOpenBoxAnim(),
            t.spine_open.node.active = !1,
            s.Util.is_wx() && s.Util.showBanner()
        },
        e)
    },
    e.prototype.playAnimOpenNext = function() {
        this.onCreateRollFrameNext(),
        this.playRollAnim(),
        this.node_btnSkip.active = !0,
        this.frame_openItems.active = !1
    },
    e.prototype.onCreateRollFrame = function() {
        this.node_rollFrame.parent.active = !1,
        this.node_rollFrame.position = cc.v3(0, 0, 0);
        for (var t = [], e = c.GetBoxAllItemsData(), o = 0; o < this.nMaxRollItem - 1; o++) {
            var i = s.Util.getRandomInt(0, e.length);
            t.push(s.Util.getCarItemData(this._curBoxType, e[i]))
        }
        for (t.push(this.arrGetItemsData[this.curShowItemIndex]), o = 0; o < t.length; o++) {
            var n = cc.v3(this.nRollItemWidth * (o - this.nRollCentIndex), 0, 0);
            if (!this.arrRollItem[o]) {
                var a = cc.instantiate(this.pfb_getItems);
                this.node_rollFrame.addChild(a),
                this.arrRollItem[o] = a
            }
            this.arrRollItem[o].position = n,
            this.arrRollItem[o].getComponent(d.default).updateView(t[o])
        }
    },
    e.prototype.onCreateRollFrameNext = function() {
        this.nMaxRollItem = this.arrRollItem.length,
        this.node_rollFrame.parent.active = !1,
        this.node_rollFrame.position = cc.v3(0, 0, 0),
        this.arrRollItem[this.nMaxRollItem - 1].getComponent(d.default).updateView(this.arrGetItemsData[this.curShowItemIndex]);
        for (var t = 0; t < this.nMaxRollItem; t++) {
            var e = cc.v3(this.nRollItemWidth * (t - this.nRollCentIndex), 0, 0);
            this.arrRollItem[t].position = e
        }
    },
    e.prototype.playRollAnim = function() {
        var t = this;
        this.node_rollFrame.parent.active = !0,
        this.bRollAnim = !0;
        var e = cc.v3( - (2 * this.nMaxRollItem + this.nRollCentIndex + .5) * this.nRollItemWidth, 0, 0);
        cc.tween(this.node_rollFrame).delay(.5).to(3, {
            position: e
        },
        {
            easing: "circInOut"
        }).delay(.5).to(.3, {
            position: cc.v3(e.x + .5 * this.nRollItemWidth, 0, 0)
        }).delay(.5).call(function() {
            t.plyOpenBoxAnim()
        }).start()
    },
    e.prototype.onRollAnim = function() {
        for (var t = 0; t < this.arrRollItem.length; t++) this.arrRollItem[t].convertToWorldSpaceAR(cc.Vec2.ZERO).x < -this.nRollItemWidth && (this.arrRollItem[t].position = cc.v3(this.nRollItemWidth * (this.nMaxRollItem - this.nRollCentIndex), 0, 0), this.nMaxRollItem++)
    },
    e.prototype.onBtnSkipRollAnim = function() {
        s.Util.hideBanner(),
        this.node_rollFrame.stopAllActions(),
        this.plyOpenBoxAnim()
    },
    e.prototype.onBtnSkip = function() {
        var t = this;
        this.playAudio(l.Audio_ID.btn_click);
        var e = function() {
            t.curShowItemIndex++,
            t.curShowItemIndex >= t.nGetItemsNum ? t.showAllGetView() : (t.arrGetItems[t.curShowItemIndex] ? (t.arrGetItems[t.curShowItemIndex].updateView(t.arrGetItemsData[t.curShowItemIndex]), t.arrGetItems[t.curShowItemIndex].node.active = !0) : (t.arrGetItems[t.curShowItemIndex] = t.createItem(t.arrGetItemsData[t.curShowItemIndex]), t.arrGetItems[t.curShowItemIndex].node.active = !0), e())
        };
        e()
    },
    e.prototype.onBtnGetAllItems = function() {
        this.playAudio(l.Audio_ID.btn_click);
        var t = !1;
        1 == r.default.nTotalGame && _.default.getIns().logEvent(_.LogEventType.Box1Collect, "", 2);
        for (var e = 0; e < this.arrGetItems.length; e++) this.arrGetItems[e].node.active && (this.arrGetItems[e].getItemType() == c.Basics_Items_Type.gold && (this.playGetGoldAnim(this.arrGetItems[e].node), t = !0), this.arrGetItems[e].getItemType() == c.Basics_Items_Type.diamond && (this.playGetDiamondAnim(this.arrGetItems[e].node), t = !0));
        t || (this.onSetOwnGold(!0), this._hallControl && this._hallControl.onSetOwnGold(), this.onBtnClose())
    },
    e.prototype.onBtnGetVideoItems = function() {
        var t = this;
        this.playAudio(l.Audio_ID.btn_click),
        s.Util.showRewardVideo(function() {
            for (var e = 0,
            o = t.arrGetItemsData; e < o.length; e++) {
                var i = o[e];
                i.type && i.type == c.Basics_Items_Type.diamond && r.default.saveDiamondData(!0, i.num),
                i.type && i.type == c.Basics_Items_Type.gold && r.default.saveGoldData(!0, i.num)
            }
            r.default.saveOwnCarData(t.arrGetItemsData);
            for (var n = !1,
            a = 0; a < t.arrGetItems.length; a++) t.arrGetItems[a].node.active && (t.arrGetItems[a].getItemType() == c.Basics_Items_Type.gold && (t.playGetGoldAnim(t.arrGetItems[a].node), n = !0), t.arrGetItems[a].getItemType() == c.Basics_Items_Type.diamond && (t.playGetDiamondAnim(t.arrGetItems[a].node), n = !0));
            n || (t.onSetOwnGold(!0), t._hallControl && t._hallControl.onSetOwnGold(), t.onBtnClose())
        })
    },
    e.prototype.showRewardView = function(t, e) {
        var o = this;
        this.resetView(),
        this.nGetItemsNum = t.length,
        this._hallControl = e,
        this.bGetOpenBox = !1,
        s.Util.hideBanner(),
        this.playAudio(l.Audio_ID.btn_click);
        try {
            this.scheduleOnce(function() {
                o.playAudio(l.Audio_ID.gacha_opening)
            },
            1)
        } catch(h) {}
        this.node_light.stopAllActions(),
        this.node_bg_open.active = !0,
        this.node_topFrame.active = !0,
        this.node_openTitle.active = !1,
        this.frame_openBtn.active = !1,
        this.node_getItem.active = !1,
        this.curShowItemIndex = 0,
        this.arrGetItemsData = [];
        for (var i = 0,
        n = t; i < n.length; i++) {
            var a = n[i];
            this.arrGetItemsData.push(a),
            a.type && a.type == c.Basics_Items_Type.diamond && r.default.saveDiamondData(!0, a.num),
            a.type && a.type == c.Basics_Items_Type.gold && r.default.saveGoldData(!0, a.num)
        }
        for (var d = 0; d < this.arrGetItems.length; d++) this.arrGetItems[d].node.active = !1;
        this.arrGetItems[this.curShowItemIndex] ? (this.arrGetItems[this.curShowItemIndex].updateView(this.arrGetItemsData[this.curShowItemIndex]), this.arrGetItems[this.curShowItemIndex].setPos(0), this.arrGetItems[this.curShowItemIndex].node.active = !0) : (this.arrGetItems[this.curShowItemIndex] = this.createItem(this.arrGetItemsData[this.curShowItemIndex]), this.arrGetItems[this.curShowItemIndex].node.active = !0),
        this.spine_open.node.active = !1,
        this.onCreateRollFrame(),
        this.frame_open.active = !0,
        this.plyOpenBoxAnim(),
        1 != this.nGetItemsNum || this.showAllGetView()
    },
    e.prototype.onBtnClose = function() {
        this.playAudio(l.Audio_ID.btn_click),
        this.unscheduleAllCallbacks(),
        this._hallControl && this._hallControl.onGuideAction(),
        this._hallControl && this._hallControl.boxViewCallMatch(),
        s.Util.hideBanner(),
        y.default.getIntance().hide_majia_banner(),
        this.node.destroy(),
        s.Util.hideNativeBanner(),
        s.Util.hideBoxNativeInsertAd()
    },
    e.prototype.playGetGoldAnim = function(t) {
        var e = this;
        this.playAudio(l.Audio_ID.get_gold);
        var o = this.icon_gold.convertToWorldSpaceAR(cc.Vec3.ZERO);
        s.Util.AnimFly(p.Fly_Type.Gold, this.pfb_goldfly, t, o,
        function() {
            e.onSetOwnGold(!0)
        },
        function() {
            e._hallControl && e._hallControl.onSetOwnGold(),
            e.onBtnClose()
        })
    },
    e.prototype.playGetDiamondAnim = function(t) {
        var e = this;
        this.playAudio(l.Audio_ID.get_gold);
        var o = this.icon_diamond.convertToWorldSpaceAR(cc.Vec3.ZERO);
        s.Util.AnimFly(p.Fly_Type.Diammond, this.pfb_goldfly, t, o,
        function() {
            e.onSetOwnDiamond(!0)
        },
        function() {
            e._hallControl && e._hallControl.onSetOwnDiamond(),
            e.onBtnClose()
        })
    },
    e.prototype.getAllItemsData = function() {
        if (r.default.nGuideStep == l.Guide_Step.Box_Get_open1) {
            var t = [],
            e = [];
            e = [{
                data: c.getBodyData("body02"),
                star: 1
            },
            {
                data: c.getWeaponData(c.Weapon_ID.Rocket),
                star: 1
            },
            {
                data: c.getWheelData("wheel01"),
                star: 1
            },
            {
                data: c.getWheelData("wheel01"),
                star: 1
            }];
            for (var i = 0; i < e.length; i++) t.push(s.Util.getCarItemData(this._curBoxType, e[i].data, e[i].star));
            return r.default.saveGuideStepData(l.Guide_Step.UnlockCar_2),
            !this.bGetOpenBox && this._hallBoxItem ? this._hallBoxItem.onOpenBox(t) : r.default.saveOwnCarData(t),
            t
        }
        if (r.default.nGuideStep == l.Guide_Step.Box_Get_open2) {
            var n = [];
            for (e = [], this.nGetItemsNum = 2, e = [{
                data: c.getWeaponData(c.Weapon_ID.Saw),
                star: 1
            },
            {
                data: c.getToolsData(c.Tools_ID.Harpoon),
                star: 1
            }], console.log("获取的车辆信息1：" + e), i = 0; i < e.length; i++) n.push(s.Util.getCarItemData(this._curBoxType, e[i].data, e[i].star));
            return r.default.saveGuideStepData(l.Guide_Step.Assembly_In),
            !this.bGetOpenBox && this._hallBoxItem ? this._hallBoxItem.onOpenBox(n) : r.default.saveOwnCarData(n),
            console.log("获取的车辆信息2：" + n),
            n
        }
        switch (this._curBoxType) {
            case o.Box_Type.common:
                this.nGetItemsNum = 2;
            break;
            case o.Box_Type.middle:
                this.nGetItemsNum = 3;
            break;
            case o.Box_Type.senior:
                this.nGetItemsNum = 5;
            break;
            default: this.nGetItemsNum = 2;
        }
        if (this._curBoxType == o.Box_Type.middle && 1 == r.default.openEpicBoxNum) {
            var a = [];
            for (i = 0; i < this.nGetItemsNum - 2; i++) a.push(this.getCommonItem());
            return cc.log("首次开启史诗宝箱100%获得一个1星史诗部件"),
            a.push(this.getEpicItem(null, 1)),
            a.push(this.getGoldItemData(this._curBoxType)),
            !this.bGetOpenBox && this._hallBoxItem ? this._hallBoxItem.onOpenBox(a) : r.default.saveOwnCarData(a),
            a
        }
        if (this._curBoxType == o.Box_Type.senior && 1 == r.default.openLegendBoxNum && 0 == r.default.isShopView) {
            var d = [];
            for (i = 0; i < this.nGetItemsNum - 2; i++) d.push(this.getCommonItem());
            return cc.log("第1次开启传说宝箱100%获得一个4星史诗部件"),
            d.push(this.getEpicItem(null, 4)),
            d.push(this.getDiamondItemData()),
            !this.bGetOpenBox && this._hallBoxItem ? this._hallBoxItem.onOpenBox(d) : r.default.saveOwnCarData(d),
            d
        }
        if (this._curBoxType == o.Box_Type.senior && 2 == r.default.openLegendBoxNum) {
            var h = [];
            for (i = 0; i < this.nGetItemsNum - 1; i++) if (console.log("第二次开启传说宝箱 非商店场景"), Math.random() <= .65) {
                var p = [0, 0, .7, .2, .1];
                h.push(this.getCommonItem(p))
            } else p = [0, .2, .5, .2, .1],
            h.push(this.getEpicItem(p));
            return h.push(this.getDiamondItemData()),
            !this.bGetOpenBox && this._hallBoxItem ? this._hallBoxItem.onOpenBox(h) : r.default.saveOwnCarData(h),
            h
        }
        if (this._curBoxType == o.Box_Type.senior && r.default.isShopView && r.default.openShopBoxNum % 3 == 0) {
            console.log("每3次打开商店传说宝箱");
            var u = [];
            for (u.push(this.getLegendItem([.4, .2, .2, .15, .05])), u.push(this.getEpicItem([0, .2, .5, .2, .1])), i = 0; i < 2; i++) u.push(this.getCommonItem([0, 0, .7, .2, .1]));
            return u.push(this.getDiamondItemData()),
            !this.bGetOpenBox && this._hallBoxItem ? this._hallBoxItem.onOpenBox(u) : r.default.saveOwnCarData(u),
            u
        }
        var f = [];
        for (this.isMustLegend = 10 == r.default.openShopLegendBoxNum, this.isMustEpic = 5 == r.default.openShopEpicBoxNum, i = 0; i < this.nGetItemsNum - 1; i++) f.push(this.getBoxItem());
        return this._curBoxType == o.Box_Type.senior ? f.push(this.getDiamondItemData()) : f.push(this.getGoldItemData(this._curBoxType)),
        !this.bGetOpenBox && this._hallBoxItem ? this._hallBoxItem.onOpenBox(f) : r.default.saveOwnCarData(f),
        f
    },
    e.prototype.getBoxItem = function() {
        if (this._curBoxType == o.Box_Type.common) {
            var t = [.65, .3, .05, 0, 0];
            return this.getCommonItem(t)
        }
        return this._curBoxType == o.Box_Type.middle ? this.isMustEpic ? (this.isMustEpic = !1, this.getEpicItem()) : Math.random() <= .75 ? (t = [.3, .45, .2, .05, 0], this.getCommonItem(t)) : (t = [.5, .4, .1, 0, 0], this.getEpicItem(t)) : this._curBoxType == o.Box_Type.senior ? r.default.isShopView && this.isMustLegend ? (this.isMustLegend = !1, this.getLegendItem()) : (e = Math.random()) <= .55 ? (t = [0, 0, .7, .2, .1], this.getCommonItem(t)) : e <= .85 ? (t = [0, .2, .5, .2, .1], this.getEpicItem(t)) : (t = [.4, .2, .2, .15, .05], this.getLegendItem(t)) : void 0;
        var e
    }, e.prototype.getCommonItem = function(t, e) {
        var o = c.GetBoxAllItemsData(),
        i = [];
        3 == r.default.openShopCommonBoxNum && (e = 3, r.default.addOpenShopCommonBoxNum(!0));
        for (var n = 0,
        a = o; n < a.length; n++) {
            var l = a[n];
            l.quality == f.Quality.common && i.push(l)
        }
        var d = i[s.Util.getRandomInt(0, i.length)];
        return e ? s.Util.getCarItemData(this._curBoxType, d, e) : t ? s.Util.getCarItemData(this._curBoxType, d, s.Util.getRandomStar(t)) : s.Util.getCarItemData(this._curBoxType, d)
    },
    e.prototype.getEpicItem = function(t, e) {
        for (var o = [], i = 0; i < c.Basics_Weapon_Info.length; i++) {
            var n = c.Basics_Weapon_Info[i];
            n.quality == f.Quality.epic && o.push(n)
        }
        var a = c.Basics_Body_Info[Math.floor(Math.random() * c.Basics_Body_Info.length)];
        Math.random() < .5 && (a = o[Math.floor(Math.random() * o.length)]);
        var l = null;
        return 5 == r.default.openShopEpicBoxNum && (e = 4, r.default.addOpenShopEpicBoxNum(!0)),
        (l = e ? s.Util.getCarItemData(this._curBoxType, a, e) : t ? s.Util.getCarItemData(this._curBoxType, a, s.Util.getRandomStar(t)) : s.Util.getCarItemData(this._curBoxType, a)).type == c.Basics_Items_Type.weapon ? l: (l.buff = c.getBuffItem(l), l.hp = Math.round(1.5 * l.hp), l)
    },
    e.prototype.getLegendItem = function(t, e) {
        for (var o = [], i = 0; i < c.Basics_Weapon_Info.length; i++) c.Basics_Weapon_Info[i].quality == f.Quality.Legendary && o.push(c.Basics_Weapon_Info[i]);
        var n = o[Math.floor(Math.random() * o.length)],
        a = null;
        return 10 == r.default.openShopLegendBoxNum && (e = 4, r.default.addOpenShopLegendBoxNum(!0)),
        (a = e ? s.Util.getCarItemData(this._curBoxType, n, e) : t ? s.Util.getCarItemData(this._curBoxType, n, s.Util.getRandomStar(t)) : s.Util.getCarItemData(this._curBoxType, n)).quality = f.Quality.Legendary,
        a
    },
    e.prototype.getGoldItemData = function(t, e) {
        if (e) return r.default.saveGoldData(!0, e),
        {
            type: c.Basics_Items_Type.gold,
            num: e
        };
        var i = 0;
        switch (t) {
            case o.Box_Type.common:
                i = s.Util.getRandomInt(500, 600);
            break;
            case o.Box_Type.middle:
                i = s.Util.getRandomInt(7e3, 1e4);
            break;
            case o.Box_Type.senior:
                i = s.Util.getRandomInt(13e3, 25e3);
        }
        return r.default.saveGoldData(!0, i),
        {
            type: c.Basics_Items_Type.gold,
            num: i
        }
    },
    e.prototype.getDiamondItemData = function(t) {
        return t ? (r.default.saveDiamondData(!0, t), {
            type: c.Basics_Items_Type.diamond,
            num: s.Util.getRandomInt(80, 150)
        }) : (e = s.Util.getRandomInt(80, 150), r.default.saveDiamondData(!0, e), {
            type: c.Basics_Items_Type.diamond,
            num: e
        });
        var e
    }, e.prototype.createItem = function(t) {
        var e = cc.instantiate(this.pfb_getItems);
        return e.getComponent(d.default).setPos(0),
        this.node_getItem.addChild(e),
        e.getComponent(d.default).updateView(t),
        e.getComponent(d.default)
    },
    e.prototype.updateAttribute = function(t) {
        for (var e = 0; e < this.arrNode_star.length; e++) this.arrNode_star[e].active = e < t.star;
        this.nodeHp.active = !1,
        this.nodeDamage.active = !1,
        this.nodeElec.active = !1;
        var o = [cc.v3(46, 0, 0), cc.v3(146, 0, 0), cc.v3(246, 0, 0)],
        i = 0;
        t.hp > 0 && (this.nodeHp.active = !0, this.nodeHp.getComponent(cc.Label).string = "" + t.hp, this.nodeHp.position = o[i], i++),
        t.damage > 0 && (this.nodeDamage.active = !0, this.nodeDamage.getComponent(cc.Label).string = "" + t.damage, this.nodeDamage.position = o[i], i++),
        t.elec > 0 && (this.nodeElec.active = !0, this.nodeElec.getComponent(cc.Label).string = "" + t.elec, this.nodeElec.position = o[i], i++)
    },
    e.prototype.playAudio = function(t) {
        h.default.getInstance().SendMessage(l.Broadcast_Func.Audio, t)
    },
    a([C(cc.Prefab)], e.prototype, "pfb_getItems", void 0),
    a([C(cc.Prefab)], e.prototype, "pfb_goldfly", void 0),
    a([C(cc.Node)], e.prototype, "node_bg_unOpen", void 0),
    a([C(cc.Node)], e.prototype, "node_bg_open", void 0),
    a([C(cc.Node)], e.prototype, "node_topFrame", void 0),
    a([C(cc.Node)], e.prototype, "frame_notOpen", void 0),
    a([C(cc.Node)], e.prototype, "frame_open", void 0),
    a([C(cc.Node)], e.prototype, "frame_get", void 0),
    a([C(cc.Node)], e.prototype, "frame_lock", void 0),
    a([C(cc.Node)], e.prototype, "frame_unlock", void 0),
    a([C(cc.Node)], e.prototype, "frame_openBtn", void 0),
    a([C(cc.Node)], e.prototype, "frame_openItems", void 0),
    a([C(cc.Label)], e.prototype, "lab_unlockTime", void 0),
    a([C(cc.Label)], e.prototype, "lab_itemsNum", void 0),
    a([C(cc.Node)], e.prototype, "node_light", void 0),
    a([C(cc.Node)], e.prototype, "node_boxIcon", void 0),
    a([C(cc.Node)], e.prototype, "node_openTitle", void 0),
    a([C(cc.Node)], e.prototype, "node_getItem", void 0),
    a([C(cc.Node)], e.prototype, "node_rollFrame", void 0),
    a([C(sp.Skeleton)], e.prototype, "spine_open", void 0),
    a([C(cc.Node)], e.prototype, "node_btnSkip", void 0),
    a([C(cc.Node)], e.prototype, "icon_gold", void 0),
    a([C(cc.Label)], e.prototype, "lab_gold", void 0),
    a([C(cc.Node)], e.prototype, "icon_diamond", void 0),
    a([C(cc.Label)], e.prototype, "lab_diamond", void 0),
    a([C(sp.Skeleton)], e.prototype, "spine_open_common", void 0),
    a([C(sp.Skeleton)], e.prototype, "spine_open_middle", void 0),
    a([C(sp.Skeleton)], e.prototype, "spine_open_senior", void 0),
    a([C(cc.Node)], e.prototype, "arrNode_star", void 0),
    a([C(cc.Node)], e.prototype, "nodeHp", void 0),
    a([C(cc.Node)], e.prototype, "nodeElec", void 0),
    a([C(cc.Node)], e.prototype, "nodeDamage", void 0),
    a([C(cc.Node)], e.prototype, "btnVideo", void 0),
    a([C(cc.Node)], e.prototype, "btnBack", void 0),
    a([v], e)
} (cc.Component);
o.default = b